package com.chaopei.user_mng.controller;

import com.chaopei.user_mng.entity.UserInfo;
import com.chaopei.user_mng.service.UserInfoService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author Corday 天涯
 * @Date 2022/4/29 14:29
 */
@RestController
@RequestMapping("/user")
public class UserInfoController {
    @Resource
    private UserInfoService userInfoService;
//     1.登录与注册http://localhost:8081/user/register
    @RequestMapping("/register")
    public String userRegister(@RequestBody UserInfo userInfo) {
        String tips = userInfoService.registerUserInfo(userInfo);
        return  tips;
    }

    /**
     *
     * @param userName
     * @param password
     * @return 字符串null,非null
     */
    @RequestMapping("/login")
    public Integer userLogin(String userName,String password){
        Integer flag= userInfoService.userLogin(userName,password);
        //如果不正确返回的将是"null";
        return flag;
    }
//    2.找回密码

//    3.修改密码
}
